              package com.java.diagnostics.visualizer.parser.vgc.j9;
              
              import com.java.diagnostics.visualizer.data.DataLevel;
              import com.java.diagnostics.visualizer.data.SourceData;
              import com.java.diagnostics.visualizer.data.StructuredDataBuilder;
              import com.java.diagnostics.visualizer.data.UnstructuredData;
              import com.java.diagnostics.visualizer.exceptions.GCAndMemoryVisualizerException;
              import com.java.diagnostics.visualizer.exceptions.GCAndMemoryVisualizerParsedDataCorruptedException;
              import com.java.diagnostics.visualizer.factory.DataFactory;
              import com.java.diagnostics.visualizer.factory.SourceDataFactory;
              import com.java.diagnostics.visualizer.gc.defaultextensions.util.Messages;
              import com.java.diagnostics.visualizer.impl.factory.LogFactory;
              import com.java.diagnostics.visualizer.parser.vgc.VGCDataManager;
              import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCReasons;
              import com.java.diagnostics.visualizer.parser.vgc.constants.VGCGCScopes;
              import com.java.diagnostics.visualizer.parser.xml.VGCXMLParser;
              import com.java.diagnostics.visualizer.properties.OutputProperties;
              import com.java.diagnostics.visualizer.sources.Source;
              import java.io.IOException;
              import java.text.MessageFormat;
              import java.util.logging.Logger;
              import javax.xml.parsers.ParserConfigurationException;
              import org.xml.sax.Attributes;
              import org.xml.sax.SAXException;
              import org.xml.sax.SAXParseException;
              
              public class InstanceJ950VGCParser extends VGCXMLParser
              {
                private static final String MAX_SOFT_REFERENCE_THRESHOLD = "maxSoftReferenceThreshold";
                private static final String DYNAMIC_SOFT_REFERENCE_THRESHOLD = "dynamicSoftReferenceThreshold";
                public static final String COUNT = "count";
                public static final String TIMETAKENMS = "timetakenms";
                public static final String OBJECTSQUEUED = "objectsqueued";
                public static final String INTERVALMS = "intervalms";
                public static final String TOTALBYTES = "totalbytes";
                public static final String FREEBYTES = "freebytes";
                public static final String EXCLUSIVEACCESSMS = "exclusiveaccessms";
                public static final String TOTALMS = "totalms";
                public static final String DURATIONMS = "durationms";
                public static final String TRACETARGET = "tracetarget";
                public static final String INTENDED_KICKOFF = "kickoff";
                public static final String ACTUAL_KICKOFF = "tenurefreebytes";
                public static final String TRACERATE = "tracerate";
                public static final String TRACED = "traced";
                public static final String CARDSCLEANED = "cardscleaned";
                public static final String FAILED = "failed";
                private static final String COMPLETED_FULL_SWEEP = "completed full sweep";
                private static final String CONNECTTIME = "connecttime";
                private static final String J9VGC_CONTENT_TYPE = "j9vgc";
                public static final Logger TRACE = LogFactory.getTrace(InstanceJ950VGCParser.class);
                private static final String COLON = ": ";
                private static final String EXCLUSIVE_ACCESS = "exclusive access";
                private static final String EXCESSIVE_GC = "excessive gc activity detected";
                private static final String OBJECT_COUNT = "objectcount";
                private static final String EVENT = "event";
                private static final String COLLECTION = "collection";
                private static final String SCAVENGER = "scavenger";
                private static final String MINIMUM = "minimum";
                private static final String REQUESTEDBYTES = "requested_bytes";
                private static final String CLASSUNLOADING = "classunloading";
                private static final String CLASSES = "classes";
                private static final String CLASSLOADERS = "classloaders";
                private static final String SYSTEM_GC = "sys";
                private static final String REFS_CLEARED = "refs_cleared";
                private static final String REFS = "refs";
                private static final String COMPACTION = "compaction";
                private static final String FLIPPED = "flipped";
                private static final String STATS = "stats";
                private static final String TIMESMS = "timesms";
                private static final String TIME = "time";
                private static final String AF = "af";
                private static final String CON = "con";
                private static final String SYS = "sys";
                private static final String INITIALIZED = "initialized";
                private boolean isNestedGC = false;
              
                private boolean ignoreStanza = false;
              
                private boolean isGencon = false;
              
                private double cardCleaningTime = 0.0D;
              
                private double sweepConnectTime = 0.0D;
              
                private int tenuredCount = 0;
              
                private int soaCount = 0;
              
                private int loaCount = 0;
              
                private int nurseryCount = 0;
                private Source source;
                private boolean beforeCollection = false;
              
                public SourceData parse(Source source, OutputProperties properties)
                  throws GCAndMemoryVisualizerException
                {
                  this.source = source;
                  this.properties = properties;
/* 197 *///          initialisePreferences();
             
                  String variantIdentifier = source.getVariantIdentifier();
                  this.sourceData = SOURCE_DATA_FACTORY.createSourceData(variantIdentifier);
                  this.dataManager = new VGCDataManager(source, this.sourceData, properties);
                  initialiseAttributeData();
                  try
                  {
                    FriendlyXMLParser parser = new FriendlyXMLParser();
                    parser.parse(source, this);
                  }
                  catch (SAXParseException e)
                  {
                    if (new J950VGCParser().isParseableSource(source))
                      throw new GCAndMemoryVisualizerParsedDataCorruptedException(
                        Messages.getString(
                        "GCAndMemoryVisualizerXMLParser.badly.formed.xml", 
                        new Object[] { e.getMessage() }), e
                        .getLineNumber(), e.getColumnNumber(), 
                        source.getName());
                  }
                  catch (SAXException se)
                  {
                    throw new GCAndMemoryVisualizerException(se);
                  }
                  catch (ParserConfigurationException pe) {
                    throw new GCAndMemoryVisualizerException(pe);
                  }
                  catch (IOException ioe) {
                    throw new GCAndMemoryVisualizerException(ioe);
                  }
                  catch (Exception e) {
                    throw new GCAndMemoryVisualizerException(e);
                  }
              
                  source.addSpecificContentType("j9vgc");
                  source.addGeneralContentType("xml");
                  return this.sourceData;
                }
              
                public void startElement(String uri, String localName, String qName, Attributes atts)
                {
                  String name = qName;
                  if (name != null) {
                    if ("file".equals(name))
                    {
                      initialiseGeneralSourceData(this.source, this.properties);
                    }
              
                    if (!this.ignoreStanza)
                      processStanza(atts, name);
                  }
                }
              
                private void processStanza(Attributes atts, String name)
                {
                  if ("file".equals(name))
                  {
                    this.ignoreStanza = false;
                  }
                  else if ("verbosegc".equals(name))
                    handleVerboseGC(atts);
                  else if ("initialized".equals(name))
                    handleInitialized(atts);
                  else if (isStartOfGCStanza(atts, name))
                    handleStartOfGCStanza(atts, name);
                  else if ("gc".equals(name))
                    handleGC(atts);
                  else if ("warning".equals(name))
                    handleWarning(atts);
                  else if ("attribute".equals(name)) {
                    if (this.inSystemAttributes)
                      handleSystemAttribute(name, atts);
                    else
                      handleGCAttribute(name, atts);
                  }
                  else if ("system".equals(name))
                    this.inSystemAttributes = true;
                  else
                    handleElement(atts, name);
                }
              
                protected boolean isStartOfGCStanza(Attributes atts, String name)
                {
                  return (atts.getValue("timestamp") != null) && (("af".equals(name)) || 
                    ("sys".equals(name)) || ("con".equals(name)));
                }
              
                private void handleInitialized(Attributes atts)
                {
                }
              
                private void handleWarning(Attributes atts)
                {
                  String details = atts.getValue("details");
                  if (details != null)
                    if (details.startsWith("exclusive access"))
                    {
                      String exclusiveAccessComment = details;
              
                      this.dataManager.updateLastComment("VGCLabels.exclusive.access.times", 
                        ": " + exclusiveAccessComment);
                    } else if (details.startsWith("excessive gc activity detected")) {
                      String excessiveGCComment = details;
                      this.dataManager.updateLastComment(
                        "VGCLabels.free.flat.heap", ": " + 
                        excessiveGCComment);
                    }
                }
              
                private void handleElement(Attributes atts, String name)
                {
                  boolean ignoreThisElement = false;
              
                  if (("stats".equals(name)) && (atts.getLength() < 2)) {
                    ignoreThisElement = true;
                  }
                  if (!ignoreThisElement)
                    if (name.equals("stats")) {
                      this.cardCleaningTime = 
                        convertStringToNumber(atts.getValue("durationms"));
                      if (this.cardCleaningTime == -1.0D) {
                        this.cardCleaningTime = 0.0D;
                      }
                      this.sweepConnectTime = 
                        convertStringToNumber(atts.getValue("connecttime"));
                      if (this.sweepConnectTime == -1.0D) {
                        this.sweepConnectTime = 0.0D;
                      }
              
                      if (atts.getValue("cardscleaned") != null) {
                        addAttribute("VGCLabels.cards.cleaned", "cardscleaned", atts);
                        addAttribute("VGCLabels.cards.traced", "traced", atts);
                      }
                      addAttribute("VGCLabels.card.cleaning.times", "durationms", atts);
                      if (!this.isNestedGC) {
                        addAttribute("VGCLabels.intended.kickoff", "kickoff", 
                          atts);
                        addAttribute("VGCLabels.trace.rate", "tracerate", atts);
                        addAttribute("VGCLabels.trace.target", "tracetarget", atts);
                        addAttribute("VGCLabels.concurrent.kickoff", "tenurefreebytes", atts);
                      }
              
                    }
                    else if (name.equals("tenured")) {
                      handleTenuredElement(atts);
                    } else if (name.equals("nursery")) {
                      handleNurseryElement(atts);
                    } else if (name.equals("soa")) {
                      handleSOAElement(atts);
                    } else if (name.equals("loa")) {
                      handleLOAElement(atts);
                    } else if (name.equals("flipped")) {
                      handleFlippedElement(atts);
                    } else if (name.equals("failed")) {
                      handleFailedElement(atts);
                    } else if (name.equals("timesms")) {
                      handleTimesMSElement(atts);
                    }
                    else if (name.equals("time")) {
                      handleTimeElement(atts);
                    } else if (this.isNestedGC) {
                      if (name.equals("compaction"))
                      {
                        String comment = atts.getValue("reason");
                        addAttribute("VGCLabels.amount.compacted", "movebytes", atts, 
                          comment);
                        addAttribute("VGCLabels.objects.compacted", "movecount", atts, 
                          comment);
                      } else if (name.equals("refs_cleared")) {
                        addAttribute("VGCLabels.soft.references.cleared", "soft", atts);
                        addAttribute("VGCLabels.phantom.references.cleared", "phantom", 
                          atts);
                        addAttribute("VGCLabels.weak.references.cleared", "weak", atts);
                      } else if (name.equals("classesunloaded")) {
                        addAttribute("VGCLabels.classes.unloaded", "count", atts);
                        addAttribute("VGCLabels.class.unloading.time", "timetakenms", 
                          atts);
                      } else if (name.equals("classloadersunloaded")) {
                        addAttribute("VGCLabels.class.loaders.unloaded", "count", atts);
                        addAttribute("VGCLabels.classloader.unloading.time", 
                          "timetakenms", atts);
                      }
                      else if (name.equals("classunloading"))
                      {
                        addAttribute("VGCLabels.classes.unloaded", "classes", atts);
                        addAttribute("VGCLabels.class.unloading.time", "timetakenms", 
                          atts);
                        addAttribute("VGCLabels.class.loaders.unloaded", "classloaders", 
                          atts);
                      } else if (name.equals("finalization")) {
                        addAttribute("VGCLabels.objects.queued.for.finalization", 
                          "objectsqueued", atts);
                      }
                      else if (name.equals("scavenger")) {
                        addAttribute("VGCLabels.tilt.ratio", "tiltratio", atts);
                      }
              
                    }
                    else if (name.equals("minimum"))
                    {
                      addAttribute("VGCLabels.request.sizes.which.triggered.failures", 
                        "requested_bytes", atts);
                    } else if (name.equals("refs")) {
                      handleRefsElement(atts);
                    }
                }
              
                private void handleRefsElement(Attributes atts)
                {
                  if ((atts.getValue("dynamicSoftReferenceThreshold") == null) && 
                    (atts.getValue("maxSoftReferenceThreshold") == null)) {
                    return;
                  }
              
                  if (this.beforeCollection) {
                    addAttribute("VGCLabels.soft.references.before.collection", "soft", atts);
                    addAttribute("VGCLabels.phantom.references.before.collection", "phantom", atts);
                    addAttribute("VGCLabels.weak.references.before.collection", "weak", atts);
                  } else {
                    addAttribute("VGCLabels.soft.references.after.collection", "soft", atts);
                    addAttribute("VGCLabels.phantom.references.after.collection", "phantom", atts);
                    addAttribute("VGCLabels.weak.references.after.collection", "weak", atts);
              
                    double softCleared = this.dataManager
                      .getLastValue("VGCLabels.soft.references.before.collection") - 
                      this.dataManager.getLastValue("VGCLabels.soft.references.after.collection");
                    addDataPoint("VGCLabels.soft.references.cleared", softCleared, 
                      this.currentComment);
                    double phantomCleared = this.dataManager
                      .getLastValue("VGCLabels.phantom.references.before.collection") - 
                      this.dataManager
                      .getLastValue("VGCLabels.phantom.references.after.collection");
                    addDataPoint("VGCLabels.phantom.references.cleared", phantomCleared, 
                      this.currentComment);
                    double weakCleared = this.dataManager
                      .getLastValue("VGCLabels.weak.references.before.collection") - 
                      this.dataManager.getLastValue("VGCLabels.weak.references.after.collection");
                    addDataPoint("VGCLabels.weak.references.cleared", weakCleared, 
                      this.currentComment);
              
                    addAttribute("VGCLabels.dynamic.soft.reference.threshold", 
                      "dynamicSoftReferenceThreshold", atts);
                    addAttribute("VGCLabels.max.soft.reference.threshold", 
                      "maxSoftReferenceThreshold", atts);
                  }
                }
              
                private void handleGC(Attributes atts)
                {
                  this.isNestedGC = true;
                  double interval = convertStringToNumber(atts.getValue("intervalms"));
                  if (atts.getValue("type") != null) {
                    String type = atts.getValue("type");
              
                    this.currentComment = 
                      (this.currentComment + SCOPE_COMMENT
                      .format(new Object[] { 
                      VGCGCScopes.intToDisplayName(VGCGCScopes.nameToInt(type)) }));
                    addDataPoint("VGCLabels.gc.scopes", 
                      VGCGCScopes.nameToInt(type), type);
                    addDataPoint("VGCLabels.gc.intervals", interval, this.currentComment);
                  }
                }
              
                private void storeTriggerIntervals(String name, double interval)
                {
                  if ("af".equals(name))
                    addDataPoint("VGCLabels.af.intervals", interval, this.currentComment);
                  else if ("sys".equals(name))
                    addDataPoint("VGCLabels.sys.intervals", interval, this.currentComment);
                  else if ("con".equals(name))
                    addDataPoint("VGCLabels.con.intervals", interval, this.currentComment);
                }
              
                private void handleStartOfGCStanza(Attributes atts, String name)
                {
                  this.currentComment = REASON_COMMENT.format(new Object[] { name });
                  this.cardCleaningTime = 0.0D;
                  this.sweepConnectTime = 0.0D;
                  this.beforeCollection = true;
                  double interval = convertStringToNumber(atts.getValue("intervalms"));
              
                  if ((interval > -1.0D) || 
                    (!"completed full sweep".equals(atts.getValue("event")))) {
                    calculateTimestamp(atts, name, interval);
                    addAttribute("VGCLabels.trigger.intervals", "intervalms", atts);
              
                    if (("af".equals(name)) || 
                      ("sys".equals(name)) || (
                      ("con".equals(name)) && 
                      ("collection"
                      .equals(atts.getValue("event")))))
                    {
                      addDataPoint("VGCLabels.gc.reasons", 
                        VGCGCReasons.nameToInt(name), name);
                      storeTriggerIntervals(name, interval);
                      this.soaCount = 0;
                      this.loaCount = 0;
                      this.tenuredCount = 0;
                      this.nurseryCount = 0;
              
                      this.isGoodData = true;
                    }
                  }
                }
              
                private void handleVerboseGC(Attributes atts)
                {
                  this.restartCount += 1;
              
                  if (this.dataManager.getCurrentX() > -1.0D) {
                    addDataPoint("VGCLabels.jvm.restarts", 1.0D, "");
                  }
              
                  workOutVersion(atts);
                }
              
                private void handleTimeElement(Attributes atts) {
                  double y = convertStringToNumber(atts.getValue("totalms"));
                  if (y > -1.0D) {
                    if (this.isNestedGC)
                    {
                      addDataPoint("VGCLabels.pause.times.without.exclusive.access", y, 
                        this.currentComment);
                    }
              
                    if (y > -1.0D) {
                      this.durations[this.reasonIndex] = y;
                    }
                    if (!this.isNestedGC) {
                      addDataPoint("VGCLabels.pause.times.with.exclusive.access", y, 
                        this.currentComment);
                    }
              
                  }
                  else if (!this.isNestedGC) {
                    addAttribute("VGCLabels.exclusive.access.times", "exclusiveaccessms", 
                      atts);
                  }
                }
              
                private void handleTimesMSElement(Attributes atts)
                {
                  double time = convertStringToNumber(atts.getValue("total"));
                  double y = time + this.cardCleaningTime;
                  y += this.sweepConnectTime;
              
                  addDataPoint("VGCLabels.pause.times.without.exclusive.access", y, 
                    this.currentComment);
              
                  if (this.isNestedGC) {
                    addAttribute("VGCLabels.mark.times", "mark", atts);
                    addAttribute("VGCLabels.sweep.times", "sweep", atts);
                    addAttribute("VGCLabels.compact.times", "compact", atts);
                  }
                }
              
                private void handleFlippedElement(Attributes atts) {
                  double numberFlipped = convertStringToNumber(
                    atts.getValue("objectcount"));
                  if (numberFlipped >= 0.0D)
                  {
                    if (this.isNestedGC) {
                      addAttribute("VGCLabels.amount.flipped", "bytes", atts);
                      addAttribute("VGCLabels.objects.flipped", "objectcount", atts);
                    }
                  }
                }
              
                private void handleFailedElement(Attributes atts) {
                  String type = atts.getValue("type");
                  if (type.equals("flipped")) {
                    addAttribute("VGCLabels.amount.failed.flipped", "bytes", atts);
                    addAttribute("VGCLabels.objects.failed.flipped", "objectcount", atts);
                  } else if (type.equals("tenured")) {
                    addAttribute("VGCLabels.amount.failed.tenured", "bytes", atts);
                    addAttribute("VGCLabels.objects.failed.tenured", "objectcount", atts);
                  }
                }
              
                private void handleTenuredElement(Attributes atts) {
                  if (this.isNestedGC) {
                    String totalBytes = atts.getValue("totalbytes");
                    if (totalBytes != null) {
                      double heapSize = convertStringToNumber(totalBytes);
              
                      if (!this.isGencon)
                      {
                        addDataPoint("VGCLabels.flat.heap.size", heapSize, 
                          this.currentComment);
              
                        String freeBytes = atts.getValue("freebytes");
                        if (freeBytes != null) {
                          double free = convertStringToNumber(freeBytes);
                          addDataPoint("VGCLabels.free.flat.heap", free, 
                            this.currentComment);
                        }
                      } else {
                        addDataPoint("VGCLabels.tenured.heap.size", heapSize, 
                          this.currentComment);
                        addAttribute("VGCLabels.free.tenured.heap", 
                          "freebytes", atts);
              
                        double nurserySize = this.dataManager
                          .getLastValue("VGCLabels.nursery.size");
                        double derivedFlatSize = heapSize + nurserySize;
                        addDataPoint("VGCLabels.flat.heap.size", derivedFlatSize, 
                          this.currentComment);
              
                        String freeTenuredBytes = atts.getValue("freebytes");
                        if (freeTenuredBytes != null) {
                          double freeNurseryBytes = this.dataManager
                            .getLastValue("VGCLabels.free.nursery.heap");
                          double derivedFlatFree = convertStringToNumber(freeTenuredBytes) + 
                            freeNurseryBytes;
                          addDataPoint("VGCLabels.free.flat.heap", 
                            derivedFlatFree, this.currentComment);
                        }
              
                      }
              
                    }
              
                  }
                  else
                  {
                    this.tenuredCount += 1;
                    String totalBytes = atts.getValue("totalbytes");
                    if (totalBytes != null) {
                      String freeBytes = atts.getValue("freebytes");
                      double heapSize = convertStringToNumber(totalBytes);
                      double free = convertStringToNumber(freeBytes);
              
                      if (this.tenuredCount == 1)
                      {
                        if (freeBytes != null) {
                          if (!this.isGencon) {
                            addDataPoint("VGCLabels.free.flat.heap.before.gc", 
                              free, this.currentComment);
                            addDataPoint("VGCLabels.total.flat.heap.before.gc", 
                              heapSize, this.currentComment);
                          } else {
                            addDataPoint("VGCLabels.free.tenured.heap.before.gc", 
                              free, this.currentComment);
                            addDataPoint(
                              "VGCLabels.total.tenured.heap.before.gc", 
                              heapSize, this.currentComment);
              
                            double freeNurseryBytes = this.dataManager
                              .getLastValue("VGCLabels.free.nursery.heap.before.gc");
              
                            double totalNurseryBytes = this.dataManager
                              .getLastValue("VGCLabels.nursery.size.before");
                            double derivedFlatFree = freeNurseryBytes + free;
                            double derivedHeapSize = totalNurseryBytes + 
                              heapSize;
                            addDataPoint("VGCLabels.free.flat.heap.before.gc", 
                              derivedFlatFree, this.currentComment);
                            addDataPoint("VGCLabels.total.flat.heap.before.gc", 
                              derivedHeapSize, this.currentComment);
                          }
                        }
                      }
                      else if (!this.isGencon) {
                        addDataPoint("VGCLabels.free.flat.heap.after.all.gcs", 
                          free, this.currentComment);
                        addDataPoint("VGCLabels.total.flat.heap.after.all.gcs", 
                          heapSize, this.currentComment);
                      } else {
                        double freeNurseryBytes = this.dataManager
                          .getLastValue("VGCLabels.free.nursery.heap.after.all.gcs");
                        double totalNurseryBytes = this.dataManager
                          .getLastValue("VGCLabels.total.nursery.heap.after.all.gcs");
                        addDataPoint("VGCLabels.free.tenured.heap.after.all.gcs", 
                          free, this.currentComment);
                        double derivedFlatFree = freeNurseryBytes + free;
                        double derivedHeapSize = totalNurseryBytes + heapSize;
                        addDataPoint("VGCLabels.free.flat.heap.after.all.gcs", 
                          derivedFlatFree, this.currentComment);
                        addDataPoint("VGCLabels.total.flat.heap.after.all.gcs", 
                          derivedHeapSize, this.currentComment);
                      }
              
                    }
              
                  }
              
                  addAttribute("VGCLabels.amount.tenured", "bytes", atts);
                  addAttribute("VGCLabels.objects.tenured", "objectcount", atts);
                }
              
                private void handleSOAElement(Attributes atts)
                {
                  if (!this.isNestedGC)
                  {
                    this.soaCount += 1;
                    String freeBytes = atts.getValue("freebytes");
                    String totalBytes = atts.getValue("totalbytes");
                    if (freeBytes != null) {
                      double free = convertStringToNumber(freeBytes);
                      double total = convertStringToNumber(totalBytes);
                      if (this.soaCount == 1) {
                        addDataPoint("VGCLabels.free.soa.before.collection", free, 
                          this.currentComment);
                        addDataPoint("VGCLabels.total.soa.before", total, 
                          this.currentComment);
                      }
                    }
                  }
                  else {
                    addAttribute("VGCLabels.free.soa.after.collection", "freebytes", atts);
                    addAttribute("VGCLabels.total.soa.after", "totalbytes", atts);
                  }
                }
              
                private void handleLOAElement(Attributes atts) {
                  if (!this.isNestedGC)
                  {
                    this.loaCount += 1;
                    String freeBytes = atts.getValue("freebytes");
                    String totalBytes = atts.getValue("totalbytes");
                    if (freeBytes != null) {
                      double free = convertStringToNumber(freeBytes);
                      double total = convertStringToNumber(totalBytes);
                      if (this.loaCount == 1) {
                        addDataPoint("VGCLabels.free.loa.before.collection", free, 
                          this.currentComment);
                        addDataPoint("VGCLabels.total.loa.before", total, 
                          this.currentComment);
                      }
                    }
                  }
                  else {
                    addAttribute("VGCLabels.free.loa.after.collection", "freebytes", atts);
                    addAttribute("VGCLabels.total.loa.after", "totalbytes", atts);
                  }
                }
              
                private void handleNurseryElement(Attributes atts) {
                  this.isGencon = true;
                  String totalBytes = atts.getValue("totalbytes");
                  if (totalBytes != null)
                    if (this.isNestedGC) {
                      double heapSize = convertStringToNumber(totalBytes);
              
                      addDataPoint("VGCLabels.nursery.size", heapSize, this.currentComment);
                      addAttribute("VGCLabels.free.nursery.heap", "freebytes", 
                        atts);
                      addAttribute("VGCLabels.tenure.age", "tenureage", atts);
                    }
                    else {
                      this.nurseryCount += 1;
                      String freeBytes = atts.getValue("freebytes");
                      if (this.nurseryCount == 1) {
                        double heapSize = convertStringToNumber(totalBytes);
                        addDataPoint("VGCLabels.nursery.size.before", heapSize, 
                          this.currentComment);
                        if (freeBytes != null) {
                          double free = convertStringToNumber(freeBytes);
                          addDataPoint("VGCLabels.free.nursery.heap.before.gc", 
                            free, this.currentComment);
                        }
                      }
                      else {
                        double free = convertStringToNumber(freeBytes);
                        addDataPoint("VGCLabels.free.nursery.heap.after.all.gcs", 
                          free, this.currentComment);
                        double heapSize = convertStringToNumber(totalBytes);
                        addDataPoint("VGCLabels.total.nursery.heap.after.all.gcs", 
                          heapSize, this.currentComment);
                      }
                    }
                }
              
                public void endElement(String uri, String localName, String qName)
                {
                  String name = qName;
              
                  if (name.equals("gc")) {
                    this.isNestedGC = false;
                    this.beforeCollection = false;
                  } else if (name.equals("sys")) {
                    this.ignoreStanza = false;
                  }
                  else if (name.equals("file"))
                  {
                    writeOutSourceData();
                  }
                }
              
                private void writeOutSourceData() {
                  if ((this.version != null) && 
                    (this.version.indexOf("-Metronome") >= 0)) {
                    this.isGoodData = false;
                  }
                  if (!this.gcAttributes.isEmpty()) {
                    this.sourceData.addData(this.gcAttributes, DataLevel.VARIANT);
                  }
                  if (!this.systemAttributes.isEmpty()) {
                    this.sourceData.addData(this.systemAttributes, DataLevel.VARIANT);
                  }
                  if (this.isGoodData)
                  {
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.free.tenured.heap.before.gc");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.free.nursery.heap.before.gc");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.free.tenured.heap.after.all.gcs");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.free.nursery.heap.after.all.gcs");
                    this.dataManager.ensureExistanceOf("VGCLabels.free.nursery.heap");
                    this.dataManager.ensureExistanceOf("VGCLabels.tenured.heap.size");
                    this.dataManager.ensureExistanceOf("VGCLabels.free.tenured.heap");
                    this.dataManager.ensureExistanceOf("VGCLabels.free.flat.heap.before.gc");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.free.flat.heap.after.all.gcs");
                    this.dataManager.ensureExistanceOf("VGCLabels.nursery.size.before");
                    this.dataManager.ensureExistanceOf("VGCLabels.nursery.size");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.total.nursery.heap.after.all.gcs");
                    this.dataManager.ensureExistanceOf("VGCLabels.amount.flipped");
                    this.dataManager.ensureExistanceOf("VGCLabels.amount.tenured");
                    this.dataManager.ensureExistanceOf("VGCLabels.amount.failed.tenured");
                    this.dataManager.ensureExistanceOf("VGCLabels.amount.failed.flipped");
                    this.dataManager.ensureExistanceOf("VGCLabels.concurrent.kickoff");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.max.soft.reference.threshold");
                    this.dataManager.ensureExistanceOf("VGCLabels.phantom.references.after.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.phantom.references.before.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.soft.references.after.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.soft.references.before.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.weak.references.after.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.weak.references.before.collection");
                    this.dataManager.ensureExistanceOf("VGCLabels.tenure.age");
                    this.dataManager.ensureExistanceOf("VGCLabels.tilt.ratio");
                    this.dataManager.ensureExistanceOf("VGCLabels.classloader.unloading.time");
                    this.dataManager.ensureExistanceOf("VGCLabels.class.loaders.unloaded");
                    this.dataManager.ensureExistanceOf("VGCLabels.classes.unloaded");
                    this.dataManager.ensureExistanceOf("VGCLabels.class.unloading.time");
                    this.dataManager.ensureExistanceOf("VGCLabels.request.sizes.which.triggered.failures");
                    this.dataManager
                      .ensureExistanceOf("VGCLabels.dynamic.soft.reference.threshold");
                    this.dataManager.ensureExistanceOf("VGCLabels.card.cleaning.times");
                    this.dataManager.ensureExistanceOf("VGCLabels.cards.cleaned");
                    this.dataManager.ensureExistanceOf("VGCLabels.cards.traced");
                    this.dataManager.ensureExistanceOf("VGCLabels.intended.kickoff");
                    this.dataManager.ensureExistanceOf("VGCLabels.trace.rate");
                    this.dataManager.ensureExistanceOf("VGCLabels.trace.target");
                    this.dataManager.ensureExistanceOf("VGCLabels.gc.reasons");
                    if (this.restartCount > 1) {
                      String message = MessageFormat.format(
                        VM_RESTART_WARNING_CONTENTS, 
                        new Object[] { Integer.valueOf(this.restartCount) });
                      UnstructuredData restarts = factory.createUnstructuredData(
                        "VGCLabels.restart.warning", 
                        Messages.getString("VGCLabels.restart.warning"), message);
                      this.sourceData.addData(restarts, DataLevel.VARIANT);
                    }
              
                    if (this.version == null)
                    {
                      this.version = "IBM J9 ";
                    }
                    recordVersion();
              
                    this.dataManager.complete();
                  }
                }
              
                protected String getCategory()
                {
                  return "VGC";
                }
              
                protected void initialiseSpecificSourceData(OutputProperties properties)
                {
                }
              }

